package com.supply.dl;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import com.dreamlive.cn.clog.CollectLog;
import com.supply.dl.utils.utils.ImgCacheUtil;
import com.supply.dl.utils.utils.Logger;

public class SupplyApplication extends MultiDexApplication {

    private static SupplyApplication app;

    @Override
    public void onCreate() {
        super.onCreate();

        app = this;

        Logger.init(getApplicationContext());   //初始化日志
        ImgCacheUtil.init(getApplicationContext());  //初始化图片加载工具类
        //android6.0也不需要动态sd权限，
        //将错误日志写入到sd卡,默认为Android/data/包名/files/logs下面放这个目录下主要是为了不需要权限
        CollectLog clog = CollectLog.getInstance();
        clog.init(this);
    }

    /**
     * 向外部提供一个获取 Application的方法
     * @return
     */
    public static SupplyApplication getAppContext() {
        return app;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}
